﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bank
{
    class Program
    {
        static void Main(string[] args)
        {
            // Открыть счет.
            // Закрыть счет.
            // Положить деньги.
            // Снять деньги.

            Bank bank = new Bank();
            string finalChoice;
            do
            {
                //Console.Clear();
                Console.WriteLine(@"Please choose the operation you want to do:
1 - Create new account;
2 - Delete an account;
3 - Add money to account;
4 - Take money from account");
                Console.Write("Task # ");
                int varChoice;
            bool incorChoice = Int32.TryParse(Console.ReadLine(), out varChoice);
            switch (varChoice)
            {
                case 1:
                    bank.GenerateAccounts();
                    bank.PrintBankInfo();
                    break;
                case 2:
                    bank.DeleteAccount();
                    bank.PrintAllAccounts();
                    break;
                case 3:
                    bank.AddMoneyToAccount();
                    bank.PrintAllAccounts();
                    break;
                case 4:
                    bank.TakeMoneyFromAccount();
                    bank.PrintAllAccounts();
                    break;
                default:
                    if (incorChoice == false || varChoice <= 0)
                    {
                        Console.WriteLine("Incorrect entering!");
                    }
                    else
                    {
                        Console.WriteLine("Choosed non-existing variant!");
                    }
                break;
                }
                Console.WriteLine("\nDo you want to choose the action once more? Y - Yes, N - No.");
                do
                {
                    finalChoice = Console.ReadLine().ToLower();
                    if (finalChoice != "y" && finalChoice != "n")
                    {
                        Console.WriteLine("Incorrect entering! Enter Y or N.");
                    }
                } while (finalChoice != "y" && finalChoice != "n");
            } while (finalChoice == "y");
            Console.WriteLine("\nThank for attention! Bye!");
        }
    }
}
